export function saleOrder(state) {
  const statusList = [{
    title: '待审核',
    operations: [{
      operation: '编辑',
      code: 'salesOrder-btn_edit',
      type: 'primary',
      next: 'edit'
    },
    {
      operation: '审核',
      code: 'salesOrder-btn_operate_check',
      type: '',
      next: 1
    }
    ]
  },
  {
    title: '已审核',
    operations: [{
      operation: '取消审核',
      code: 'salesOrder-btn_operate_not_check',
      type: 'primary',
      next: 0
    }, {
      operation: '撤销',
      code: 'salesOrder-btn_operate_backout',
      type: '',
      next: 4
    }, {
      operation: '确认',
      code: 'salesOrder-btn_operate_affirm',
      type: '',
      next: 2
    }]
  },
  {
    title: '已确认',
    operations: [{
      operation: '加工',
      code: 'salesOrder-btn_operate_process',
      type: 'primary',
      next: 3
    }, {
      operation: '撤销',
      code: 'salesOrder-btn_operate_backout',
      type: '',
      next: 4
    }]
  },
  {
    title: '生产中',
    operations: [{
      operation: '终止',
      code: 'salesOrder-btn_operate_termination',
      type: 'primary',
      next: 5
    }, {
      operation: '完工',
      code: 'salesOrder-btn_operate_finish',
      type: '',
      next: 6
    }]
  },
  {
    title: '已撤销',
    operations: []
  },
  {
    title: '已终止',
    operations: []
  },
  {
    title: '已完工',
    operations: []
  },
  {
    title: '——',
    operations: []
  }
  ]

  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5 || state == 6) {
      return statusList[state]
    } else {
      return statusList[7]
    }
  } else {
    return statusList
  }
}


export function productionPlan(state) {
  const statusList = [{
    title: '待审核',
    operations: [{
      operation: '编辑',
      code: 'mainProductionPlan-btn_edit',
      type: 'primary',
      next: 'edit'
    },
    {
      operation: '审核',
      code: 'mainProductionPlan-btn_operate_check',
      type: '',
      next: 1
    }
    ]
  },
  {
    title: '已审核',
    operations: [{
      operation: '取消审核',
      code: 'mainProductionPlan-btn_operate_not_check',
      type: 'primary',
      next: 0
    }, {
      operation: '撤销',
      code: 'mainProductionPlan-btn_operate_backout',
      type: '',
      next: 4
    }, {
      operation: 'BOM分解',
      code: 'mainProductionPlan-btn_operate_bom_decompose',
      type: '',
      next: 2
    }]
  },
  {
    title: '已分解',
    operations: [{
      operation: '生产',
      code: 'mainProductionPlan-btn_operate_process',
      type: 'primary',
      next: 3
    }, {
      operation: '撤销',
      code: 'mainProductionPlan-btn_operate_backout',
      type: '',
      next: 4
    }]
  },
  {
    title: '生产中',
    operations: [{
      operation: '终止',
      code: 'mainProductionPlan-btn_operate_termination',
      type: 'primary',
      next: 5
    }, {
      operation: '完工',
      code: 'mainProductionPlan-btn_operate_finish',
      type: '',
      next: 6
    }]
  },
  {
    title: '已撤销',
    operations: []
  },
  {
    title: '已终止',
    operations: []
  },
  {
    title: '已完工',
    operations: []
  },
  {
    title: '——',
    operations: []
  }
  ]
  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5 || state == 6) {
      return statusList[state]
    } else {
      return statusList[7]
    }
  } else {
    return statusList
  }
}

export function selfMade(state) {
  const statusList = [{
    title: '待审核',
    operations: [{
      operation: '编辑',
      code: 'selfMade-btn_edit',
      type: 'primary',
      next: 'edit'
    },
    {
      operation: '审核',
      code: 'selfMade-btn_operate',
      type: '',
      next: 1
    }
    ]
  },
  {
    title: '已审核',
    operations: [{
      operation: '取消审核',
      code: 'selfMade-btn_operate_not_check',
      type: 'primary',
      next: 0
    }, {
      operation: '撤销',
      code: 'selfMade-btn_operate_backout',
      type: '',
      next: 4
    }, {
      operation: '工艺分解',
      code: 'selfMade-btn_operate_decompose',
      type: '',
      next: 2
    }]
  },
  {
    title: '已分解',
    operations: [{
      operation: '生产',
      code: 'selfMade-btn_operate_process',
      type: 'primary',
      next: 3
    }, {
      operation: '撤销',
      code: 'selfMade-btn_operate_backout',
      type: '',
      next: 4
    }]
  },
  {
    title: '生产中',
    operations: [{
      operation: '终止',
      code: 'selfMade-btn_operate_termination',
      type: 'primary',
      next: 5
    }, {
      operation: '完工',
      code: 'selfMade-btn_operate_finish',
      type: '',
      next: 6
    }]
  },
  {
    title: '已撤销',
    operations: []
  },
  {
    title: '已终止',
    operations: []
  },
  {
    title: '已完工',
    operations: []
  },
  {
    title: '——',
    operations: []
  }
  ]

  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5 || state == 6) {
      return statusList[state]
    } else {
      return statusList[7]
    }
  } else {
    return statusList
  }
}

export function processTask(state) {
  const statusList = [{
    title: '待分发',
    operations: [{
      operation: '编辑',
      code: 'processTask-btn_edit',
      type: 'primary',
      next: 'edit'
    },
    ]
  },
  {
    title: '已分发',
    operations: [{
      operation: '编辑',
      code: 'processTask-btn_edit',
      type: 'primary',
      next: 'edit'
    }, {
      operation: '撤销',
      code: 'processTask-btn_operate_backout',
      type: '',
      next: 3
    }, {
      operation: '生产',
      code: 'processTask-btn_operate_process',
      type: '',
      next: 2
    }]
  },
  {
    title: '生产中',
    operations: [{
      operation: '编辑',
      code: 'processTask-btn_edit',
      type: 'primary',
      next: 'edit'
    }, {
      operation: '终止',
      code: 'processTask-btn_operate_termination',
      type: '',
      next: 4
    }, {
      operation: '完工',
      code: 'processTask-btn_operate_finish',
      type: '',
      next: 5
    }]
  },
  {
    title: '已撤销',
    operations: []
  },
  {
    title: '已终止',
    operations: []
  },
  {
    title: '已完工',
    operations: []
  },
  {
    title: '——',
    operations: []
  }
  ]
  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5) {
      return statusList[state]
    } else {
      return statusList[6]
    }
  } else {
    return statusList
  }
}


export function equipmentWorkOrderV(state) {
  const statusList = [{
    title: '已准备',
    operations: [
      {
        operation: '回收',
        code: '',
        next: 4
      },
      {
        operation: '撤销',
        code: '',
        next: 5
      },
      {
        operation: '编辑',
        code: '',
        next: 'edit'
      }
    ],
    color: '#E6A23C'
  },
  {
    title: '生产中',
    operations: [
      {
        operation: '编辑',
        code: '',
        next: 'edit'
      }
    ],
    color: '#67C23A'
  },
  {
    title: '已完工',
    operations: [],
    color: '#8BA8F2'
  },
  {
    title: '已暂停',
    operations: [
    // {
    //   operation: '恢复',
    //   next: 1
    // },
    // {
    //   operation: '回收',
    //   next: 4
    // },
    // {
    //   operation: '撤销',
    //   next: 5
    // },
    {
      operation: '编辑',
      next: 'edit'
    }
    ],
    color: '#F56C6C'
  },
  {
    title: '已回收',
    operations: [],
    color: '#1ED7AD'
  },
  {
    title: '已撤销',
    operations: [],
    color: '#FF7A32'
  },
  {
    title: '——',
    operations: [],
    color: '#909399'
  }
  ]

  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5) {
      return statusList[state]
    } else {
      return statusList[6]
    }
  } else {
    return statusList
  }
}


export function equipmentWorkOrder(state) {
  const statusList = [{
    title: '已准备',
    operations: [{
      operation: '启动',
      code: '',
      next: 1
    },
    {
      operation: '完工',
      code: '',
      next: 2
    },
    {
      operation: '回收',
      code: '',
      next: 4
    },
    {
      operation: '撤销',
      code: '',
      next: 5
    },
    {
      operation: '编辑',
      code: '',
      next: 'edit'
    }
    ],
    color: '#E6A23C'
  },
  {
    title: '生产中',
    operations: [{
      operation: '完工',
      code: '',
      next: 2
    }, {
      operation: '暂停',
      code: '',
      next: 3
    },
    {
      operation: '编辑',
      code: '',
      next: 'edit'
    }
    ],
    color: '#67C23A'
  },
  {
    title: '已完工',
    operations: [],
    code: '',
    color: '#909399'
  },
  {
    title: '已暂停',
    operations: [{
      operation: '恢复',
      code: '',
      next: 1
    },
    {
      operation: '完工',
      code: '',
      next: 2
    },
    {
      operation: '回收',
      code: '',
      next: 4
    },
    {
      operation: '撤销',
      code: '',
      next: 5
    },
    {
      operation: '编辑',
      code: '',
      next: 'edit'
    }
    ],
    color: '#F56C6C'
  },
  {
    title: '已回收',
    operations: [],
    color: '#1ED7AD'
  },
  {
    title: '已撤销',
    operations: [],
    color: '#FF7A32'
  },
  {
    title: '——',
    operations: [],
    color: '#909399'
  }
  ]

  if (state !== 'all') {
    if (state == 0 || state == 1 || state == 2 || state == 3 || state == 4 || state == 5) {
      return statusList[state]
    } else {
      return statusList[6]
    }
  } else {
    return statusList
  }
}